<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/static/include/top.jsp"%>
<script>document.title="用户管理";</script>

<form name="searchForm" action="" method="post">
	<input type="hidden" name="p" value="1" />
	<table>
		<tbody>
			<tr>
				<th><img src="${ctx}/static/images/pages/cen/rig/ico_01.png"
					align="absmiddle">&nbsp;用户管理</th>
			</tr>
			<tr class="tab_grey">
				<td>用户名称： <input type="text" name="loginName" id="loginName"
					value="${requestScope.loginName}" size="20" class="tab_textbut" />
					单位名称： <input type="text" name="unitName" id="unitName"
					value="${requestScope.unitName}" size="20" class="tab_textbut" /> <span
					class="tab_text">用户类型：</span> 
					<select id="roleId" name="roleId" class="tab_textbut">
						<option value="">请选择..</option>
						<c:forEach var="role" items="${roleList}">
							<option value="${role.id}">${role.roleName}</option>
						</c:forEach>
				</select> <input type="submit" value="查询" class="tab_but" />
					<input type="button" class="tab_but" value="清空" onclick="clearInput();" />
		    		<input type="button" class="tab_but"  onclick="exportUsers('${ctx}');" value="导出用户" onfocus="this.blur()"/>
		    		<input type="button" class="tab_but"  onclick="setExportFlag('${ctx}');" value="同步完成" onfocus="this.blur()"/>
				</td>
			</tr>
		</tbody>
	</table>
</form>
<script>
$("#roleId").val("${param['roleId']}");
function clearInput() {
	$("#loginName").val("");
	$("#unitName").val("");
	$("#roleId").val("");
}
</script>

<c:if test="${empty obj.operationResult}">
	<b>没有符合条件的记录。</b>
</c:if>
<c:if test="${not empty obj.operationResult}">
	<table id="listTable">
		<tbody>
			<tr>
				<th width="3%"><input type="checkbox" onclick="selectAll(this.checked);"></th>
				<th width="15%">用户名</th>
				<th width="20%">单位</th>
				<th width="10%">角色</th>
				<th width="10%">单位负责人</th>
				<th width="10%">联系电话</th>
				<th width="10%"></th>
				<th width="10%"></th>
			</tr>
			<c:forEach var="oneRow" items="${obj.operationResult}">
				<tr>
					<td><input name="chk" type="checkbox" id="chk" value="${oneRow.id}" /></td>
					<td align="left">${oneRow.userLoginname}</td>
					<td align="left">${oneRow.userUnit}</td>
					<td align="left">${oneRow.roleName}</td>
					<td align="left">${oneRow.userUnitAdmin}</td>
					<td align="left">${oneRow.userContactPhone}</td>
					<td align="left"><a href="#" id="tab_text01"
						onclick="openViewWin('${oneRow.id}');return false;">详细</a></td>
					<td align="left"><c:if test="${runMode=='WEB'}">
							<a href="#"
								id="tab_text01" onclick="reset('${oneRow.id}');return false;">重置密码</a>
						</c:if> <c:if test="${runMode=='LAN'}">
							<a href="#" id="tab_text01"
								onclick="openEditWin('${oneRow.id}');return false;">修改</a>
						</c:if></td>
				</tr>
			</c:forEach>
			<tr class="tab_grey">
				<td colspan="7" align="center" valign="middle" class="tab_white">
					<div class="pagination">
						<%@ include file="../../include/listpage2.jsp"%>
					</div>
					<div class="clear"></div>
				</td>
			</tr>
		</tbody>
	</table>
	<script>
	function openViewWin(id){
		openWin("查看详情","${baseURL}/dataManage/viewExportUser?id="+id,800,600);
	}
	function openEditWin(id){
		openWin("修改详情","${baseURL}/user/editUser?id="+id,800,600);
	}
	function reset(id) {
		$.getJSON("${baseURL}/user/resetPassword?id="+id, function(data) {
			alert(data.message);
		});
	}
	</script>
	<script src="${ctx}/static/ocean/js/listUser.js"></script>
</c:if>

<%@ include file="/static/include/bottom.jsp"%>
